package com.robotserver.orders.jobs.xxljob.instance;

import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;

/**
 * @Auther: liuqi
 * @Date: 2021/03/25 17:20
 * @Description: 创建淘宝拉取订单的API客户端单例
 */
public class AliPushOrderClient {
    private static TaobaoClient instance = null;
    private static long createtime = 0;
    public static TaobaoClient getTaobaoClient(String taobaoSdkUrl, String tb_appkey,String tb_appsecret){
       if(instance == null){
           instance = new DefaultTaobaoClient(taobaoSdkUrl, tb_appkey, tb_appsecret,"json",120000,240000);
           createtime = System.currentTimeMillis();
       }
//       else{
//           long diftime = System.currentTimeMillis() - createtime;
//           if(diftime > 100000){
//               instance = new DefaultTaobaoClient(taobaoSdkUrl, tb_appkey, tb_appsecret,"json",120000,240000);
//               createtime = System.currentTimeMillis();
//           }
//       }
        return instance;
    }
}
